<?php include "coresection/connection.php";?>
<?php include "coresection/checkSession.php";?>
<?php include "coresection/order-list.php";?>
<?php include "coresection/admin-product-week.php";?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php include 'modules/head.php'; ?>
</head>

<body>
<?php include 'modules/topbar.php'; ?>

<div class="setup_area">
    <?include 'modules/sidebar-admin.php'?>

    <div class="header">
        <h1>欢迎使用订餐系统</h1>
        <?php include 'modules/header.php'; ?>
    </div>


    <div class="content_area">

<div class="main">
    <div class="line_dash"></div>
    <h2>菜式列表</h2>

    <table cellpadding="0" cellspacing="0" border="0" class="checkTable admin_list_table">
        <thead>
        <tr>
            <td>日期</td>
            <td>菜式名</td>
            <td>单价</td>
            <td>日期</td>
            <td>三餐</td>
        </tr>
        </thead>
        <tbody>
        <?php

        $_d=1;
        $bg="style='background:#cccccc'";
        $bg_triger=0;

        for($i=0;$i<$sum;$i++){?>

            <?



            if($product_week[$i]!=$product_week[$i-1])
            {
                if($bg_triger==0){$bg_triger=1;}
                elseif($bg_triger==1){$bg_triger=0;}
            }

                    ?>

            <tr
                <?
            if($bg_triger==1)
            {
                echo $bg;
            }

            ?>
        >
            
			
			
			 
			 
            <?
            $product_number=array_count_values($product_week);

			
			
            if($product_week[$i]!=$product_week[$i-1]){
            echo "<td rowspan=".$product_number[$product_week[$i]].">";
			echo "<b>星期 ".$_d++."</b>";
			echo "</td>";
            }?>
           
			
			
			
			

			
			
			
			
			
            <td><?echo $product_names[$i]?></td>
            <td><?echo $product_price[$i]?></td>
            <td><?echo $product_week[$i]?>号</td>
            



                <?
                $row_number=0;
				
                for($_i=0;$_i<=count($product_week);$_i++)
                {
                    if($product_week[$_i]==$product_week[$i])
                    {

                        if($product_at[$_i]==$product_at[$i])
                        {
							$row_number=$row_number+1;
                             
                        }
                    }
				 

                }

 
                if($product_at[$i]!=$product_at[$i-1]) {


                    echo "<td rowspan='".$row_number."'>";
                    switch ($product_at[$i]) {
                        case 1:
                            echo "早餐";
                            break;
                        case 2:
                            echo "午餐";
                            break;
                        case 3:
                            echo "晚餐";
                            break;

                    }
                    echo "</td>";
                }


				 
                if($i==(count($product_at)-1)){

                    echo "<td >";
                    switch ($product_at[$i]) {
                        case 1:
                            echo "早餐";
                            break;
                        case 2:
                            echo "午餐";
                            break;
                        case 3:
                            echo "晚餐";
                            break;

                    }
                    echo "</td>";
                }


                ?>



            </td>

        </tr>
        <? } ?>
        </tbody>
    </table>
</div>

        <?php include 'modules/footer.php'; ?>
</body>
</html>